home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / HOTJAVA_ / HOTJAVA / CLASSSRC / BROWSER / STYLET~2.JAV < prev    next >
Encoding:
Text File  |  1995-08-11  |  1.5 KB  |  55 lines

  1. /*
  2.  * @(#)StyleTagRef.java    1.7 95/03/14 Jonathan Payne
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package browser;
  21.  
  22. import java.util.*;
  23. import java.io.*;
  24. import awt.*;
  25. import net.*;
  26. import net.www.http.*;
  27. import net.www.html.*;
  28.  
  29. /**
  30.  * Class StyleTagRef is used for html tags that have Style's
  31.  * associated with them.  This handles the apply method by turning
  32.  * it into start/finish methods on the associated style.
  33.  * @version 1.7, 14 Mar 1995
  34.  * @author Jonathan Payne
  35.  */
  36.  
  37. public class StyleTagRef extends WRTagRef {
  38.     Style   style;
  39.  
  40.     public StyleTagRef(Tag t, int pos, boolean isEnd, Style s) {
  41.     super(t, pos, isEnd);
  42.     style = s;
  43.     }
  44.  
  45.     public void apply(WRFormatter f) {
  46.     if (style != null) {
  47.         if (!isEnd) {
  48.         style.start(f, this);
  49.         } else {
  50.         style.finish(f, this);
  51.         }
  52.     }
  53.     }
  54. }
  55.